package main

import "fmt"

//组合

type X3411 struct {
	a int
}

type Y3411 struct {
	X3411
	b int
}

type Z3411 struct {
	Y3411
	c int
}

func main() {
	x := X3411{
		a: 1,
	}

	y := Y3411{
		X3411: x,
		b:     2,
	}

	z := Z3411{
		Y3411: y,
		c:     3,
	}

	//z.a, z.Y3411.a, z.Y3411.X3411.a此时表示相同字段
	fmt.Println(z.a, z.Y3411.a, z.Y3411.X3411.a)
	z.a = 10
	fmt.Println(z.a, z.Y3411.a, z.Y3411.X3411.a)
}
